package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.PowerOrderItemMapper;
import com.ruoyi.system.domain.PowerOrderItem;
import com.ruoyi.system.service.IPowerOrderItemService;

/**
 * 订单详情Service业务层处理
 * 
 * @author ljl
 * @date 2025-03-21
 */
@Service
public class PowerOrderItemServiceImpl implements IPowerOrderItemService 
{
    @Autowired
    private PowerOrderItemMapper powerOrderItemMapper;

    /**
     * 查询订单详情
     * 
     * @param orderItemId 订单详情主键
     * @return 订单详情
     */
    @Override
    public PowerOrderItem selectPowerOrderItemByOrderItemId(Long orderItemId)
    {
        return powerOrderItemMapper.selectPowerOrderItemByOrderItemId(orderItemId);
    }

    /**
     * 查询订单详情列表
     * 
     * @param powerOrderItem 订单详情
     * @return 订单详情
     */
    @Override
    public List<PowerOrderItem> selectPowerOrderItemList(PowerOrderItem powerOrderItem)
    {
        return powerOrderItemMapper.selectPowerOrderItemList(powerOrderItem);
    }

    /**
     * 新增订单详情
     * 
     * @param powerOrderItem 订单详情
     * @return 结果
     */
    @Override
    public int insertPowerOrderItem(PowerOrderItem powerOrderItem)
    {
        powerOrderItem.setCreateTime(DateUtils.getNowDate());
        return powerOrderItemMapper.insertPowerOrderItem(powerOrderItem);
    }

    /**
     * 修改订单详情
     * 
     * @param powerOrderItem 订单详情
     * @return 结果
     */
    @Override
    public int updatePowerOrderItem(PowerOrderItem powerOrderItem)
    {
        powerOrderItem.setUpdateTime(DateUtils.getNowDate());
        return powerOrderItemMapper.updatePowerOrderItem(powerOrderItem);
    }

    /**
     * 批量删除订单详情
     * 
     * @param orderItemIds 需要删除的订单详情主键
     * @return 结果
     */
    @Override
    public int deletePowerOrderItemByOrderItemIds(Long[] orderItemIds)
    {
        return powerOrderItemMapper.deletePowerOrderItemByOrderItemIds(orderItemIds);
    }

    /**
     * 删除订单详情信息
     * 
     * @param orderItemId 订单详情主键
     * @return 结果
     */
    @Override
    public int deletePowerOrderItemByOrderItemId(Long orderItemId)
    {
        return powerOrderItemMapper.deletePowerOrderItemByOrderItemId(orderItemId);
    }
}
